﻿@model ZSZ.DTO.PermissionDTO
@{
    ViewBag.Title = "Edit";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

<form id="formEdit">
    <input type="hidden" id="id" value="@Model.Id" />
    名称：<input type="text" name="name" id="name" value="@Model.Name" />
    描述：<input type="text" name="description" id="description" value="@Model.Description" />
    <input type="button" value="保存" id="btnSave" />
</form>

@section FooterScript
{
    <script type="text/javascript">
    var saveAjax = function () {
        $.ajax({
            url: "/Permission/Edit",
            type: "post",
            data: {
                id:$("#id").val(),
                name: $("#name").val(),
                description: $("#description").val()
            },
            dataType: "json",
            success: function (res) {
                if (res.status == "ok") {
                    //alert("ok");
                    parent.location.reload();
                } else {
                    alert("error");
                }
            },
            error: function () { alert("ajax error")}
        });
    }
    $(function () {
        $("#btnSave").click(saveAjax);
    });
    </script>
}

